import { TableListItem } from '@/pages/peopleList/blacklist-list/data';
import { request } from 'umi';

export async function getCurrentUser(params: any) {
  return request('/api/user/currentUser', {
    method: 'GET',
    params,
  });
}
export async function saveCommunityAttention(params: any) {
  return request('/api/manage/saveCommunityAttention', {
    method: 'POST',
    data: params,
  });
}

// 关注社区
export async function getCommunity(
  params: {
    // query
    /** 当前的页码 typescript */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  },
  options?: { [key: string]: any }
) {
  return request<{
    data: TableListItem[];
    /** 列表的内容总数 */
    total?: number;
    success?: boolean;
  }>('/api/manage/getCommunity', {
    method: 'GET',
    params: {
      ...params,
      is_delet: 0,
    },
    ...(options || {}),
  });
}
export async function getCommunityAttention(params: any) {
  return request('/api/manage/getCommunityAttention', {
    method: 'GET',
    params,
  });
}

// 排行榜
export async function getCommunityRank(params: any) {
  return request('/api/analyse/getCommunityRank', {
    method: 'POST',
    data: params,
  });
}
